<?php
/**
 * Created by PhpStorm.
 * User: win10
 * Date: 2020/3/4
 * Time: 20:11
 */


namespace app\portal\model;

use Think\Db;
use think\Model;

class ShoppingModel extends Model{

    public $page = 10;
    public function shopping($where=[]){

        $category = $this->alias('s')->join('category','category.id=s.c_id')
            ->where($where)->order('date','desc')
            ->field('s.*,category.name as cate')
            ->paginate($this->page);

        return $category;

    }



    public function shows($table)
    {
       return  Db::query("show create table $table");
    }
    public function sh($table,$list,$str)
    {

        foreach ($list as $k => $v) {
            $values = implode(',', array_values($v));
            $values = str_replace(',', "','", $values);
            $str .= "INSERT INTO `$table` VALUES ('" . $values . "');*****";
        }
        return $str;
    }
}